import Vue from 'vue'
import VueRouter from 'vue-router'
const Home = () => import('@/views/home/home.vue')
const Category = () => import('@/views/category/category.vue')
const Cart = () => import('@/views/cart/cart.vue')
const Profile = () => import('@/views/profile/profile.vue')
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'login',
        component: () => import('@/views/login/indexPage.vue'),
        meta: {title: '登录'}
    },
    {
        path: '/index',
        name: 'index',
        component: () => import('@/views/index/indexPage.vue'),
        meta: {title: '首页'}
    },
    {
        path: '/myPage',
        name: 'myPage',
        component: () => import('@/views/myPage/indexPage.vue'),
        meta: {title: '我的'}
    },
    {
        path: '/examRecord',
        name: 'examRecord',
        component: () => import('@/views/examRecord/indexPage.vue'),
        meta: {title: '考试记录'}
    },
    {
        path: '/paperInfo',
        name: 'paperInfo',
        component: () => import('@/views/paperInfo/indexPage.vue'),
        meta: {title: '试卷中心'}
    },
    {
        path: '/do',
        name: 'do',
        component: () => import('@/views/paper/do/indexPage.vue'),
        meta: {title: '试卷答题'}
    },
    {
        path: '/showPaper',
        name: 'showPaper',
        component: () => import('@/views/showPaper/indexPage.vue'),
        meta: {title: '试卷答题'}
    },
    {
        path: '*',
        hidden: true,
        component: () => import('@/views/error/404Page.vue'),
        meta: {title: '404', noCache: true}
    },
    {
        path:'',
        redirect:'/home'
    },
    {
        path:'/home',
        component:Home
    },
    {
        path:'/category',
        component:Category
    },
    {
        path:'/cart',
        component:Cart
    },
    {
        path:'/profile',
        component:Profile
    },
    {
        path:'/pastExam',
        component:()=>import('@/views/myPage/pastExam/indexPage.vue')
    },
    {
        path:'/tranPage',
        component:()=>import('@/views/training/indexPage.vue')
    },
    {
        path:'/showPast',
        component:()=>import('@/views/showPast/indexPage.vue')
    },
    {
        path:'/myExam',
        component:()=>import('@/views/myExam/indexPage.vue')
    }
]

const router = new VueRouter({
    routes,
    mode:'hash'
})

export default router
